function sum(a: number, b: number) {
  return a + b;
}

let a: number = sum(1, 9);
console.log(a);

let b: string = sum(1, 9) as unknown as string;
console.log(b);

function sum2(a: number, b: number): string {
  return `${a + b}`;
}
console.log(sum2(2, 4));

// 如果函数没有返回值，最好加上void，这样不用看函数体只用看函数定义就知道有没有返回值
function msg(): void {
  console.log("Hello TypeScript");
}

msg();

// 箭头函数定义返回值
let sum3 = (a: number, b: number): string => {
  return `${a + b}`;
};
console.log(sum3(4, 3));
